package com.gxa.controller.HhyController;

import com.gxa.service.SelectByCardTimeService;
import com.gxa.utils.R;
import com.gxa.vo.PatientRegInfoVo;
import com.gxa.vo.SelectByCardTimeVo;
import com.gxa.vo.UpdateRemakeVo;
import io.swagger.annotations.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Api(tags="挂号信息相关接口")
@RestController
public class RegInfoController {
    @Autowired
    private SelectByCardTimeService selectByCardTimeService;

    @ApiOperation(value = "挂号详情接口",produces = "application/json",response = R.class)
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "Authorization", value = "令牌", paramType = "header",dataType ="String" ,required = true)
    })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "返回xx详细信息",examples = @io.swagger.annotations.Example(
                    value = {
                            @ExampleProperty(value = "{'code':200,'msg':'描述'}}", mediaType = "application/json")
                    })),
            @ApiResponse(code = 306, message = "登录已超时，请重新登录"),
            @ApiResponse(code = 307, message = "令牌格式不正确"),
            @ApiResponse(code = 401, message = "没有权限"),
            @ApiResponse(code = 403, message = "无效请求，本系统只支持AJAX请求"),
            @ApiResponse(code = 500, message = "服务器内部错误")
    })
    @RequiresPermissions("pre:sel")
    @PostMapping("/reg/regOneInformation")
    public R regInformation(@ApiParam(name="appRegister-为参数名",value = "挂号信息参数--这里写参数描述",required = true)@RequestBody SelectByCardTimeVo selectByCardTimeVo){
        List<PatientRegInfoVo> list = this.selectByCardTimeService.selectByCardTime(selectByCardTimeVo);
        System.out.println(list);

        return R.ok().put("data",list);
    }

    @ApiOperation(value = "修改挂号备注接口",produces = "application/json",response = R.class)
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "Authorization", value = "令牌", paramType = "header",dataType ="String" ,required = true)
    })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "返回xx详细信息",examples = @io.swagger.annotations.Example(
                    value = {
                            @ExampleProperty(value = "{'code':200,'msg':'描述'}}", mediaType = "application/json")
                    })),
            @ApiResponse(code = 306, message = "登录已超时，请重新登录"),
            @ApiResponse(code = 307, message = "令牌格式不正确"),
            @ApiResponse(code = 401, message = "没有权限"),
            @ApiResponse(code = 403, message = "无效请求，本系统只支持AJAX请求"),
            @ApiResponse(code = 500, message = "服务器内部错误")
    })
    @RequiresPermissions("pre:update")
    @PutMapping("/reg/updateRemake")
    public R insertRemark(@ApiParam(name="remark-为参数名",value = "订单备注信息--用于门诊消费记录的订单备注",required = true)@RequestBody UpdateRemakeVo updateRemakeVo){
        System.out.println(updateRemakeVo);
        this.selectByCardTimeService.updateRemake(updateRemakeVo);
        return R.ok();
    }
}
